



$(document).ready(function(){

	$("#searchlist").click(function() {
		
		var param="board_type="+$("#board_type").val();
		    param+="&board_cd="+$("#board_cd").val();
		    param+="&searchfl="+$("#searchfl").val();
		    param+="&searchct="+$("#searchct").val();
		    param+="&cpage="+$("cpage").val();
		    param+="&totalPage="+$("#totalPage").val();
		    
	    $('form').attr("action",contextPath+"/board/detview.do?"+param); //action 寃쎈� 吏��
		$('form').attr("method","get"); 
		$('form').submit();	
	});
	

});

function checkSubmit( action ,method )
{	
	
	var frm =  document.form;
	
	if( frm.title != undefined ) {
		if( trim(frm.title.value) == "" ) {
			alert( "제목을 입력해주세요." );
			frm.title.focus();
			return;
		}
	}
	
	if( frm.writer != undefined ) {
		if( trim(frm.writer.value) == "" ) {
			alert( "작성자를 입력해주세요." );
			frm.writer.focus();
			return;
		}
	}
	
	if( frm.content != undefined ) {
		if( trim(frm.content.value) == "" ) {
			alert( "내용을 입력해주세요" );
			frm.content.focus();
			return;
		}
	}
	
	frm.action = contextPath+action;
	frm.method =method;
	frm.submit();
}



function mcheckSubmit( frm )
{	
	
	
	
	if( frm.title != undefined ) {
		if( trim(frm.title.value) == "" ) {
			alert( "제목을 입력해주세요." );
			frm.title.focus();
			return;
		}
	}
	
	if( frm.writer != undefined ) {
		if( trim(frm.writer.value) == "" ) {
			alert( "작성자를 입력해주세요." );
			frm.writer.focus();
			return;
		}
	}
	
	if( frm.content != undefined ) {
		if( trim(frm.content.value) == "" ) {
			alert( "내용을 입력해주세요" );
			frm.content.focus();
			
			return false;
		}
	}
	
	frm.action = contextPath+action;
	frm.method =method;
	frm.submit();
}

function delSubmit( frm )
{	
	
	frm.submit();
	
}



function upcheckSubmit( frm )
{
	
	 return true;
		
}


function ajaxView(parm1,parm2,parm3) {
	
	
	    $.ajax({	
	      type: "GET",
	      url: "/board/ajaxview.do?board_type="+parm1+"&board_cd="+parm2+"&article_no="+parm3,
	      dataType: "json",
	      success:function( data ) {
	    	
	    	
	        $("#title").text(data.title);
	        $("#writer").text(data.writer);
	        $("#regdate").text(data.regdate);
	        $("#acontent").html(data.content);
	        	        
	      },
	      error :function(result){
	    	  alert("잠시후 다시 시도해주세요.");
	    	  
	      }

	    });
	
}


//추천 후기 
function ajaxReView(parm1,parm2,parm3,parm4) {
	
	
	
  $.ajax({	
    type: "GET",
    url: "/board/ajaxview.do?board_type="+parm1+"&board_cd="+parm2+"&article_no="+parm3,
    dataType: "json",
    success:function( data ) {
  	
  	//현재  view_inbox 콘텐츠
  	$(eval("view_inbox"+parm4)).empty();
  	
      var html = "<div><ul><li class='inbox_title'><h2>"+data.title+"</h2></li>";
      	html +="<li class='inbox_name'>작성자 :<span>"+data.writer+"</span></li>";
      	html +="<li class='inbox_date'>작성일 :<span>"+data.regdate+"</span></li>";
      	html +="</ul><p>"+data.content+"</p></div>";	
      
    
     $(eval("view_inbox"+parm4)).html(html);
      	        
    },
    error :function(result){
  	  alert("잠시후 다시 시도해주세요.");
  	  
    }

  });

}




